package com.qf.redis.utils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

@Component
public class IDUtils {

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    private String idKey = "redis:user:id";

    public Long getId() {
        Long increment = stringRedisTemplate.opsForValue().increment(idKey);
        return increment;
    }
}
